package com.nhim.cms.admin.server;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import com.google.gwt.requestfactory.server.ServiceLayerDecorator;
import com.google.gwt.requestfactory.shared.ServiceLocator;

public class SpringServiceLocator implements ServiceLocator {

	@Autowired
	private ApplicationContext context;
	
	@Autowired
	private ServiceLayerDecorator serviceLayerDecorator;

	public Object getInstance(Class<?> clazz) {
		return context.getBean(serviceLayerDecorator.resolveDomainClass(clazz));
	}

}
